{% if paginator.has_pages %}
    <div class="paging tr">
        {% if paginator.num_pages %}
            <div class="fl">Page {{ paginator.page }}{% if paginator.num_pages %} of {{ paginator.num_pages }}{% endif %}</div>
            <ul>
                <li class="prev">{% if paginator.has_previous %}<a href="?{{ query_string|escape }}&amp;p={{ paginator.previous_page }}{%if anchor%}#{{anchor}}{%endif%}">Previous</a>{% else %}<span>Previous</span>{% endif %}</li>
                {% for p in paginator.page_range %}
                    <li{% if p == paginator.page %} class="active"{% endif %}><a href="?{{ query_string|escape }}&amp;p={{ p }}{%if anchor%}#{{anchor}}{%endif%}">{{ p }}</a></li>
                {% endfor %}
                <li class="next">{% if paginator.has_next %}<a href="?{{ query_string|escape }}&amp;p={{ paginator.next_page }}{%if anchor%}#{{anchor}}{%endif%}">Next</a>{% else %}<span>Next</span>{% endif %}</li>
            </ul>
        {% else %}
            <ul class="basic">
                <li class="fl">{% if paginator.has_previous %}<a href="?{{ query_string|escape }}&amp;p={{ paginator.previous_page }}{%if anchor%}#{{anchor}}{%endif%}">Previous Page</a>{% else %}<span>Previous Page</span>{% endif %}</li>
                <li class="fr">{% if paginator.has_next %}<a href="?{{ query_string|escape }}&amp;p={{ paginator.next_page }}{%if anchor%}#{{anchor}}{%endif%}">Next Page</a>{% else %}<span>Next Page</span>{% endif %}</li>
            </ul>
        {% endif %}
    </div>
{% endif %}
